package com.by.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitConfig {

    /**
     * 普通队列
     * @return
     */
    @Bean
    public Queue queue(){
        return new Queue("queue", true, false, true, null);
    }

    /**
     * 普通交换器
     */
    @Bean
    public DirectExchange directExchange(){
        return new DirectExchange("normal-ex");
    }

    /**
     * 绑定普通队列与交换器
     */
    @Bean
    public Binding binding(DirectExchange directExchange,Queue queue){
        return BindingBuilder.bind(queue).to(directExchange).with("normal");
    }
}
